/**
 * Created by bethinner on 5/17/16.
 */
import React, { Component } from 'react';

export default class BottomBar extends Component {
    constructor(props) {
        super(props);
    }

    componentWillMount() {

    }

    handleClick(e) {
        if (this.props.btnClick()) {
            this.props.btnClick();
        }
        e.stopPropagation();
        e.preventDefault();
    }

    render() {
        //console.log(this.props.stock);
        if(this.props.isBuy<=0){
            return (
            <div style={NewStyle}>
                卡券已售空
            </div>
            )
        }else{
            return (
                <div style={BarStyle}
                     onClick={this.handleClick.bind(this)}>
                    {this.props.text}
                </div>
            )
        }
    }
}
let BarStyle = {
    color: "white",
    backgroundColor: "#FF6347",
    fontSize: "20px",
    textAlign: "center",
    position: 'fixed',
    zIndex: "2",
    bottom: '0px',
    width: '100%',
    height: '50px',
    lineHeight: "50px"
};
let NewStyle={
    color: "white",
    backgroundColor: "#999999",
    fontSize: "20px",
    textAlign: "center",
    position: 'fixed',
    zIndex: "2",
    bottom: '0px',
    width: '100%',
    height: '50px',
    lineHeight: "50px"
}
BottomBar.defaultProps = {
    text: "",
    btnClick: null
}

BottomBar.propTypes = {
    text: React.PropTypes.string,
    btnClick: React.PropTypes.func
}


